package com.ruoyi.peach.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.peach.mapper.MessagesMapper;
import com.ruoyi.peach.domain.Messages;
import com.ruoyi.peach.service.IMessagesService;

/**
 * 会话记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-24
 */
@Service
public class MessagesServiceImpl implements IMessagesService 
{
    @Autowired
    private MessagesMapper messagesMapper;

    /**
     * 查询会话记录
     * 
     * @param messageId 会话记录主键
     * @return 会话记录
     */
    @Override
    public Messages selectMessagesByMessageId(Long messageId)
    {
        return messagesMapper.selectMessagesByMessageId(messageId);
    }

    /**
     * 查询会话记录列表
     * 
     * @param messages 会话记录
     * @return 会话记录
     */
    @Override
    public List<Messages> selectMessagesList(Messages messages)
    {
        return messagesMapper.selectMessagesList(messages);
    }

    /**
     * 新增会话记录
     * 
     * @param messages 会话记录
     * @return 结果
     */
    @Override
    public Messages insertMessages(Messages messages)
    {
        int i = messagesMapper.insertMessages(messages);
        if(i == 1){
            return messages;
        }else {
            return null;
        }

    }

    /**
     * 修改会话记录
     * 
     * @param messages 会话记录
     * @return 结果
     */
    @Override
    public int updateMessages(Messages messages)
    {
        return messagesMapper.updateMessages(messages);
    }

    /**
     * 批量删除会话记录
     * 
     * @param messageIds 需要删除的会话记录主键
     * @return 结果
     */
    @Override
    public int deleteMessagesByMessageIds(Long[] messageIds)
    {
        return messagesMapper.deleteMessagesByMessageIds(messageIds);
    }

    /**
     * 删除会话记录信息
     * 
     * @param messageId 会话记录主键
     * @return 结果
     */
    @Override
    public int deleteMessagesByMessageId(Long messageId)
    {
        return messagesMapper.deleteMessagesByMessageId(messageId);
    }
}
